<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>练习</title>
		<script src="js/d3.v4.min.js" charset="utf-8"></script>
	</head>
	<body>
		
		<script>
			//折线图等可使用
			//创建画布
			var svg=d3.select("body").append("svg").attr("height",600).attr("width",600);
			//线段的点数据，每一项是点的x和y坐标
			var line=[[80,80],[200,100],[200,200],[100,200]];
			//创建一个线段生成器
			var linePath=d3.line();
			//添加路径
			svg.append("path")
			   .attr("d",linePath(line))
			   .attr("stroke","black")
			   .attr("stroke-width","3px");
/*			var lines=[80,120,160,200,240,280];
			var linepath=d3.line()
						   .x(function(d){return d;})
						   .y(function(d,i){return i%2==0?40:120;});
			svg.append("path").attr("d",linepath(lines))
							  .attr("stroke","black")
							  .attr("stroke-width","3px")
							  .attr("fill","none");
*/
			
			
		</script>
		
	</body>
</html>
